home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / examples / C / x07c.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  2.2 KB  |  97 lines

  1. /* $Id: x07c.c,v 1.9 1994/06/30 17:57:34 mjl Exp $
  2.  * $Log: x07c.c,v $
  3.  * Revision 1.9  1994/06/30  17:57:34  mjl
  4.  * All C example programs: made another pass to eliminate warnings when using
  5.  * gcc -Wall.  Lots of cleaning up: got rid of includes of math.h or string.h
  6.  * (now included by plplot.h), eliminated redundant casts, put in more
  7.  * uniform comments, and other minor changes.
  8.  *
  9.  * Revision 1.8  1994/03/30  07:21:51  mjl
  10.  * Changes to all C example programs: special handling for malloc re: header
  11.  * files eliminated, include of stdio.h and stdlib.h eliminated (now done
  12.  * by plplot.h), include of "plplot.h" changed to <plplot.h> to enable
  13.  * simpler builds by the general user, some cleaning up also.
  14. */
  15.  
  16. /*    x07c.c
  17.  
  18.     Font demo.
  19. */
  20.  
  21. #ifdef MSDOS
  22. #pragma optimize("",off)
  23. #endif
  24.  
  25. #include <plplot.h>
  26.  
  27. static int base[17] =
  28. {0, 200, 500, 600, 700, 800, 900,
  29.  2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900};
  30.  
  31. /*----------------------------------------------------------------------*\
  32.  * main
  33.  *
  34.  * Displays the entire "plsym" symbol (font) set.
  35. \*----------------------------------------------------------------------*/
  36.  
  37. int
  38. main(int argc, char *argv[])
  39. {
  40.     char text[4];
  41.     int i, j, k, l;
  42.     PLFLT x, y;
  43.  
  44. /* Parse and process command line arguments */
  45.  
  46.     (void) plParseInternalOpts(&argc, argv, PL_PARSE_FULL);
  47.  
  48. /* Initialize plplot */
  49.  
  50.     plinit();
  51.  
  52.     plfontld(1);
  53.     for (l = 0; l < 17; l++) {
  54.     pladv(0);
  55.  
  56. /* Set up viewport and window */
  57.  
  58.     plcol(2);
  59.     plvpor(0.15, 0.95, 0.1, 0.9);
  60.     plwind(0.0, 1.0, 0.0, 1.0);
  61.  
  62. /* Draw the grid using plbox */
  63.  
  64.     plbox("bcgt", 0.1, 0, "bcgt", 0.1, 0);
  65.  
  66. /* Write the digits below the frame */
  67.  
  68.     plcol(15);
  69.     for (i = 0; i <= 9; i++) {
  70.         sprintf(text, "%d", i);
  71.         plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, text);
  72.     }
  73.  
  74.     k = 0;
  75.     for (i = 0; i <= 9; i++) {
  76.  
  77. /* Write the digits to the left of the frame */
  78.  
  79.         sprintf(text, "%d", base[l] + 10 * i);
  80.         plmtex("lv", 1.0, (0.95 - 0.1 * i), 1.0, text);
  81.         for (j = 0; j <= 9; j++) {
  82.         x = 0.1 * j + 0.05;
  83.         y = 0.95 - 0.1 * i;
  84.  
  85. /* Display the symbols */
  86.  
  87.         plsym(1, &x, &y, base[l] + k);
  88.         k = k + 1;
  89.         }
  90.     }
  91.  
  92.     plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols");
  93.     }
  94.     plend();
  95.     exit(0);
  96. }
  97.